/**
 * Created by luohao on 2016/10/11.
 */
$("table").on("click", ".rent", function () {
    $.ajax({
        url:"user/rent",
        type:"put",
        data:{"bookid":$(this).attr("about"),"borrowid":$(this).attr("value")},
        dataType:"json",
        success:function(data){
            switch(data.status) {
                case 1:
                    alert(data.mag);
                    window.location.reload();
                    break;
                case 0:
                    alert(data.mag);
                    break;
            }
        }
    });
});


$("table").on("click", ".last", function () {
    $.ajax({
        url:"user/last",
        type:"put",
        data:{"borrowid":$(this).attr("value")},
        dataType:"json",
        success:function(data){
            switch(data.status) {
                case 1:
                    alert(data.mag);
                    window.location.reload();
                    break;
                case 0:
                    alert(data.mag);
                    break;
            }
        }
    });
});